<?php namespace App\Http\Middleware;

use Closure;
use App\Http\Classes\Common;

class AdminToken {

	/**
	 * Handle an incoming request.
	 *
	 * @param  \Illuminate\Http\Request  $request
	 * @param  \Closure  $next
	 * @return mixed
	 */
	public function handle($request, Closure $next)
	{
        //var_dump($request->session());
        $session = $request->session()->all();
        if(isset($session['admin'])){
            return $next($request);
        }
        else{
            return Common::response(503,'你的通行证已经过期了',null);
        }
	}

}
